package com.csdj.t309springboot.mapper;
import com.csdj.t309springboot.entity.PrizeRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
/**
 * <p>
 * 获奖信息表 Mapper 接口
 * </p>
 *
 * @author 谭湛宇
 * @since 2022-01-14
 */
public interface PrizeRecordMapper extends BaseMapper<PrizeRecord> {
    /**
     * 连表查询最新获奖信息, 按获奖时间倒序排列, 只显示 6条
     * @return list列表
     */
    @Select("SELECT prize_winner_id,prize_name,prize_image_url,the_prize_winning_date,nickname " +
            "FROM `prize_record` AS p ,`user` AS u " +
            "WHERE p.prize_winner_id=u.id " +
            "ORDER BY the_prize_winning_date DESC limit 6")
    List<PrizeRecord> findTheLatestAward();
}
